/*
 * @Author: wurangkun wurangkun@qq.com
 * @Date: 2023-05-18 08:58:10
 * @LastEditors: wurangkun wurangkun@qq.com
 * @LastEditTime: 2023-05-18 11:51:54
 * @FilePath: \vue3+ts\src\utils\router.ts
 * @Description: 路由方法配置
 */

/**
 * 页面枚举
 */
export enum Pages {
  首页 = '/',
  登录 = '/login',
  推荐 = '/recommed',
  文件 = '/file',
  编辑 = '/edit',
}
import router from '@/router'
import type { RouteParamsRaw } from 'vue-router'

export const to = (to: Pages, params?: RouteParamsRaw) => {
  router.push({ path: to, query: { ...params } })
}
export const redirct = (to: Pages, params?: RouteParamsRaw) => {
  router.replace({ path: to, query: params })
}

export const back = () => {
  router.back()
}

export const go = (index: number) => {
  router.go(index)
}